package com.hoshiibuy.sys.permission.entity.param;

import java.io.Serializable;

import org.apache.commons.lang3.StringUtils;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hoshiibuy.common.query.CommonParam;
import com.hoshiibuy.sys.permission.entity.SysPermissiones;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * <p>
 * 查询权限参数
 * </p>
 * 
 * @author Mr.Wu
 * @since 2019-04-27
 */
@Data
public class SysPermissionesQueryParam extends CommonParam implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * id
	 */
	@ApiModelProperty(value = "id")
	private Long id;

	/**
	 * 所属系统
	 */
	@ApiModelProperty(value = "所属系统")
	private Long systemId;

	/**
	 * 所属上级
	 */
	@ApiModelProperty(value = "所属上级")
	private Long pid;

	/**
	 * 名称
	 */
	@ApiModelProperty(value = "名称")
	private String name;

	/**
	 * 类型(1:目录,2:菜单,3:按钮)
	 */
	@ApiModelProperty(value = "类型(1:目录,2:菜单,3:按钮)")
	private Integer type;

	/**
	 * 权限值
	 */
	@ApiModelProperty(value = "权限值")
	private String permissionValue;

	/**
	 * 路径
	 */
	@ApiModelProperty(value = "路径")
	private String uri;

	/**
	 * 图标
	 */
	@ApiModelProperty(value = "图标")
	private String icon;

	/**
	 * 状态(0:禁止,1:正常)
	 */
	@ApiModelProperty(value = "状态(0:禁止,1:正常)")
	private Integer status;

	/**
	 * 排序
	 */
	@ApiModelProperty(value = "排序")
	private Long orders;

	public QueryWrapper<SysPermissiones> getQueryWrapper() {
		QueryWrapper<SysPermissiones> queryWrapper = new QueryWrapper<SysPermissiones>();
		queryWrapper.eq(this.id != null, "id", this.id);
		queryWrapper.eq(this.systemId != null, "system_id", this.systemId);
		queryWrapper.eq(this.pid != null, "pid", this.pid);
		queryWrapper.eq(StringUtils.isNotBlank(this.name), "name", this.name);
		queryWrapper.eq(this.type != null, "type", this.type);
		queryWrapper.eq(StringUtils.isNotBlank(this.permissionValue), "permission_value", this.permissionValue);
		queryWrapper.eq(StringUtils.isNotBlank(this.uri), "uri", this.uri);
		queryWrapper.eq(StringUtils.isNotBlank(this.icon), "icon", this.icon);
		queryWrapper.eq(this.status != null, "status", this.status);
		queryWrapper.eq(this.orders != null, "orders", this.orders);
		return queryWrapper;
	}
}
